package com.education.welco.service.impl;


import com.education.common.utils.Convert;
import com.education.welco.mapper.SQuestionsMapper;
import com.education.welco.pojo.SQuestions;
import com.education.welco.service.ISQuestionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 试卷试题 服务层实现
 *
 * @author d
 * @date 2020-05-12
 */
@Service
public class SQuestionsServiceImpl implements ISQuestionsService {

    @Autowired
    private SQuestionsMapper sQuestionsMapper;

    @Override
    public List<SQuestions> selectByCatalogIdAndType(Integer catalogId, Integer type, Integer classId) {
        return sQuestionsMapper.selectByCatalogIdAndType(catalogId,type, classId);
    }

    /**
     * 查询试卷试题信息
     *
     * @param catalogId 试卷试题ID
     * @return 试卷试题信息
     */
    @Override
    public List<SQuestions> selectByCatalogId(Integer catalogId) {
        return sQuestionsMapper.selectByCatalogId(catalogId);
    }

    /**
     * 查询试卷试题信息
     *
     * @param id 试卷试题ID
     * @return 试卷试题信息
     */
    @Override
    public SQuestions selectSQuestionsById(Integer id) {
        return sQuestionsMapper.selectSQuestionsById(id);
    }


    /**
     * 查询试卷试题列表
     *
     * @param sQuestions 试卷试题信息
     * @return 试卷试题集合
     */
    @Override
    public List<SQuestions> selectSQuestionsListOther(SQuestions sQuestions) {
        return sQuestionsMapper.selectSQuestionsListOther(sQuestions);
    }

    /**
     * 查询试卷试题列表
     *
     * @param sQuestions 试卷试题信息
     * @return 试卷试题集合
     */
    @Override
    public List<SQuestions> selectSQuestionsList(SQuestions sQuestions) {
        return sQuestionsMapper.selectSQuestionsList(sQuestions);
    }

    /**
     * 新增试卷试题
     *
     * @param sQuestions 试卷试题信息
     * @return 结果
     */
    @Override
    public int insertSQuestions(SQuestions sQuestions) {
        return sQuestionsMapper.insertSQuestions(sQuestions);
    }

    /**
     * 修改试卷试题
     *
     * @param sQuestions 试卷试题信息
     * @return 结果
     */
    @Override
    public int updateSQuestions(SQuestions sQuestions) {
        return sQuestionsMapper.updateSQuestions(sQuestions);
    }


    /**
     * 删除试卷试题信息
     *
     * @param id 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSQuestionsById(Integer id) {
        return sQuestionsMapper.deleteSQuestionsById(id);
    }

    /**
     * 删除试卷试题对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSQuestionsByIds(String ids) {
        return sQuestionsMapper.deleteSQuestionsByIds(Convert.toStrArray(ids));
    }
}